#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC optimize(2)
//#pragma GCC optimize(3)
//#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
//#include <immintrin.h>
//#include <emmintrin.h>
#define int long long
#define fi first
#define se second
#define ls(x) ((x)*2)
#define rs(x) ((x)*2+1)
#define Debug(...) fprintf(stderr, __VA_ARGS__)
#define For(i,a,b) for(int i=a,i##end=b;i<=i##end;i++)
#define Rof(i,a,b) for(int i=a,i##end=b;i>=i##end;i--)
#define rep(i,  b) for(int i=1,i##end=b;i<=i##end;i++)
using namespace std;
const int N=1e6+5,base=999983,Mod=1e9+7;
//char buf[(1<<21)+5],*p1,*p2;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
inline void chmx(int &x,int y){(x<y)&&(x=y);}
inline void chmn(int &x,int y){(x>y)&&(x=y);}
inline void Add(int &x,int y){(x=x+y+Mod)%=Mod;}
inline int read(){
	int f=0,x=0;
	char ch=getchar();
	while(!isdigit(ch)){f|=(ch=='-');ch=getchar();}
	while(isdigit(ch)){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
	return f?-x:x;
}
void print(int n){
    if(n<0){
        putchar('-');
        n*=-1;
    }
    if(n>9) print(n/10);
    putchar(n%10+'0');
}
int n;
vector<int>a[N];
bool vis[N];set<int>s;
inline int find(int x){
return *s.lower_bound(x);	
}
inline bool cmp(vector<int>a,vector<int>b){
	Rof(i,0,min(a.size()-1,b.size()-1)){
		if(a[a.size()-1-i]!=b[b.size()-1-i]) return a[a.size()-1-i]>b[b.size()-1-i];
	}
	return a.size()>b.size();
}
inline bool cmb(vector<int>a,vector<int>b){
	if(a.size()==b.size())
	Rof(i,0,min(a.size()-1,b.size()-1)){
		if(a[a.size()-1-i]!=b[b.size()-1-i]) return a[a.size()-1-i]>b[b.size()-1-i];
	}
	return a.size()<b.size();
}
vector<int>q[N];
signed main(){
	freopen("mcmf.in","r",stdin);
	freopen("mcmf.out","w",stdout);
	// ios::sync_with_stdio(false);
	// cin.tie(0); cout.tie(0);
	n=read();bool flag=0;
	int sum=0,mx=0;
	For(i,1,n){
		int k=read();sum+=k;
		For(j,1,k){
			int x=read();
			a[i].push_back(x);
			mx=max(mx,x);
		}
		if(k!=1)flag=1;
	}
	if(!flag){
		For(i,1,N-5) s.insert(i);
		For(i,1,n){
			int x=a[i][0];
			x=*s.lower_bound(x);
			s.erase(x);
			vis[x]=1;
		}
		bool f0=1;
		Rof(i,N-5,1){
			if(f0&&!vis[i]) continue;
			f0=0;
			printf("%d",vis[i]);
		}
		return 0;
	}
	For(i,1,N-5) s.insert(i);
	sort(a+1,a+n+1,cmb);
	For(i,1,n){
		Rof(k,a[i].size()-1,0){
			if(vis[a[i][k]]){
				int p=find(a[i][k]);
				if(k==(int)a[i].size()-1){
					int x=find(a[i][a[i].size()-1]+1);
					vis[x]=1;s.erase(x);
					break;
				}
				if(p>=a[i][k+1]){
					int x=find(a[i][a[i].size()-1]+1);
					vis[x]=1;s.erase(x);
					break;
				}
				vis[p]=1;s.erase(p);
				For(j,k+1,a[i].size()-1) vis[a[i][j]]=1,s.erase(a[i][j]);
				break;
			}
			if(k==0){
				for(auto v:a[i]){
					vis[v]=1;
					s.erase(v);
				}
			}
		}
	}
	
	bool f0=1;
	Rof(i,N-5,1){
		if(f0&&!vis[i]) continue;
		f0=0;
		printf("%d",vis[i]);
	}
#ifdef LOCAL
    Debug("\nMy Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}

